package spoon.task;

import org.jsoup.select.Elements;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import spoon.service.WilliamhillService;

@Component
public class WilliamhillFootballTask {

	@Autowired
	@Qualifier("williamhillFootballService")
	private WilliamhillService williamhillService;
	
	private Elements elements = new Elements();
	
	//@Scheduled(fixedRateString = "${williamhill.football.delay}")
	public void taskGame() {
		
		if (elements.size() == 0) {
			this.elements.addAll(williamhillService.getLeagueList());
			return;
		}
		
		williamhillService.getLeague(elements.remove(0));
		
	}
}
